import { PaginationProps } from "antd/es/pagination/Pagination";

export function formateDate(time: Date): string {
	if (!time) return "";
	let date = new Date(time);
	return `${date.getFullYear()}-${date.getMonth() - 1}-${date.getDate()}  ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
}

export function getPaginationConfig(data: any, callback?: any): Object {
	let config: PaginationProps = {
		current: data.current,
		pageSize: data.pageSize,
		total: data.total,
		onChange: (currentPage: number, pageSize?: number) => {
			callback(currentPage, pageSize);
		},
		showTotal: () => `共${data.total}条数据`,
		showQuickJumper: true
	};

	return config;
}
